<template>
  <d2-container>
    <template slot="header" style="margin: 0 auto;height:15%;width:90%">
      <h1>日考核单号:      {{assessDetail.orderNumber}}</h1>
      <el-descriptions >
          <el-descriptions-item label="单号">{{assessDetail.orderNumber}}</el-descriptions-item>
          <el-descriptions-item label="创建人">{{assessDetail.createName}}</el-descriptions-item>
          <el-descriptions-item label="创建时间">{{assessDetail.createTime}}</el-descriptions-item>
          <el-descriptions-item label="状态">
          <el-tag size="small">{{assessDetail.check == "0"?'未审核':'已审核'}}</el-tag>
          </el-descriptions-item>
          <el-descriptions-item  label="金额">{{assessDetail.bonus}}</el-descriptions-item>
      </el-descriptions>
        <el-button type="primary" class="backtrack" @click="back2summary()">返回</el-button>
    </template>
    <template style="background-color: #FFFFFF ">
      <h3>流程进度</h3>
          <el-divider></el-divider>
      <el-steps :active= flowstatus align-center>
        <el-step title="创建日考核" :description=assessDetail.createName></el-step>
        <el-step title="审核" :description=assessDetail.assessedName></el-step>
        <el-step title="领取" description=""></el-step>
        <el-step title="发放" description=""></el-step>
      </el-steps>
                <el-divider></el-divider>
      <h3>考核信息</h3>
                <el-divider></el-divider>
      <el-descriptions >
          <el-descriptions-item label="考核分类">日考核</el-descriptions-item>
          <el-descriptions-item label="制度来源">{{assessDetail.clauseType}}</el-descriptions-item>
          <el-descriptions-item label="被考核人">{{assessDetail.assessPersonName}}</el-descriptions-item>
          <el-descriptions-item label="考核人">{{assessDetail.assessedName}}</el-descriptions-item>
          <el-descriptions-item  label="发生时间">{{assessDetail.assessTime}}</el-descriptions-item>
          <el-descriptions-item label="考核时间">{{assessDetail.assessTime}}</el-descriptions-item>
      </el-descriptions>
      <h3>考核明细单</h3>
          <el-divider></el-divider>
      <el-descriptions >
          <el-descriptions-item label="加扣类型">加奖</el-descriptions-item>
          <el-descriptions-item label="金额">{{assessDetail.bonus}}</el-descriptions-item>
      </el-descriptions>
      <h3>具体考核项</h3>
          <el-divider></el-divider>
<el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="加/扣金额">
            <span>{{ props.row.money }}</span>
          </el-form-item>
          <el-form-item label="加/扣分数">
            <span>{{ props.row.score }}</span>
          </el-form-item>
          <el-form-item label="创建人">
            <span>{{ props.row.createName}}</span>
          </el-form-item>
          <el-form-item label="创建时间">
            <span>{{ props.row.createdTime }}</span>
          </el-form-item>
        </el-form>
      </template>
    </el-table-column>
    <el-table-column
      label="ID"
      prop="id"
      width="100px"
      >
    </el-table-column>
    <el-table-column
      label="描述"
      prop="name">
    </el-table-column>
    <el-table-column
      label="修改人"
      prop="updatedName">
    </el-table-column>
    <el-table-column
      label="修改时间"
      prop="updateTime"
      >
    </el-table-column>
  </el-table>

    </template>
  </d2-container>
</template>
<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
  .backtrack {
        position: absolute;
        left: 95%;
        top:5%;
        transform: translate(-50%,-50%);
  }
</style>
<script>
export default {
  name: 'page2',
  projectIdStr: '',
  data () {
    return {
      flowstatus: 2,
      assessDetail: {},
      tableData: []
    }
  },
  created () {
    this.getParamId()
  },
  // 只有调用才执行的方法
  methods: {
    // 页面加载展示数据
    getdata (id) {
      // alert('这是我传的id',id)
      console.log('这是我传过来的id', id)
      console.log('这是我传过来的id', this.$route.query.id)
      this.$request({
        url: 'dailyAssess/findById',
        method: 'post',
        params: { id: id }
      }).then((res) => {
        if (res.check === 1) {
          this.flowstatus = 3
        }
        this.assessDetail = res
        this.findDetail(res)
        console.log(res)
      })
    },
    // 查看考核内容详情
    findDetail (res) {
      this.$request({
        url: 'dayAssessDetail/findDetailById',
        method: 'post',
        data: res
      }).then((res) => {
        this.tableData = res
        console.log(res)
      })
    },
    // 新增路由跳转
    back2summary () {
      this.$router.push('/summary')
    },
    getParamId () {
      var dadId = this.$route.query.id
      this.getdata(dadId)
    }
  }
}
</script>
